<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>支付超时列表</title>
    <script src="{{ env('CDN_DOMAIN_NAME') }}/js/commonjs/rem.js"></script>
    <link rel="stylesheet" type="text/css" href="{{ env('CDN_DOMAIN_NAME') }}/css/commoncss/common.css"/>
    <link rel="stylesheet" type="text/css" href="{{ env('CDN_DOMAIN_NAME') }}/css/push.css"/>
</head>
<script src="{{ env('CDN_DOMAIN_NAME') }}/js/commonjs/iscroll.js"></script>
<script src="{{ env('CDN_DOMAIN_NAME') }}/js/app.js"></script>
<script src="{{ env('CDN_DOMAIN_NAME') }}/js/commonjs/common.js"></script>
<body>
<div id="box_push">
    <div class="wrap">
        <div class="push">
            @if(count($orders) > 0)
            @foreach($orders as $k => $v)
            <ul class="push_main">
                <li class="push_li">
                    <span class="push_sp1">订单编号:</span>
                    <span class="push_sp2">{{ $v->ordernum }}</span>
                </li>
                <li class="push_li">
                    <span class="push_sp1">用户姓名:</span>
                    <span class="push_sp2">{{ $v->username }}</span>
                </li>
                <li class="push_li">
                    <span class="push_sp1">联系方式:</span>
                    <span class="push_sp2">{{ $v->user_tel }}</span>
                </li>
                <li class="push_li">
                    <span class="push_sp1">下单时间:</span>
                    <span class="push_sp2">{{ $v->created_at }}</span>
                </li>
                <li class="push_li">
                    <span class="push_sp1">实际付款:</span>
                    <span class="push_sp2">{{sprintf('%.2f', $v->total_price) }}</span>
                </li>
                {{--<li class="push_li">--}}
                    {{--<span class="push_sp1">优惠金额:</span>--}}
                    {{--<span class="push_sp2">{{sprintf('%.2f', $v->total_price - $v->actual_price) }}</span>--}}
                {{--</li>--}}
                <li class="push_li" abc="{{ $v->ordernum }}">
                    <button class="btn1 push_btn" value="1">重新开启支付</button>
                    <button class="btn2 push_btn" value="-2">取消交易</button>
                </li>
            </ul>
                @endforeach
            @else
            <div class="push_hint">尚无需处理订单!</div>
            @endif
        </div>
    </div>
    <div class="push_mask" style="display:none;"></div>
    <div class="push_div" style="display:none;">
		<p class="push_p1">操作成功!</p>
		<p class="push_p2">确定</p>
	</div>
    <meta name="csrf_token" id="token" content="{{ csrf_token() }}">
</div>
</body>
<script>
    scroll();
    $('.push_btn').click(function () {
        var val = $(this).val();
        var ordernum = $(this).parent('.push_li').attr('abc');
        var model = $(this);
        $.ajax({
            url:'/h5_admin/updateOrderStatus',
            type:'POST',
            data:{val:val,ordernum:ordernum},
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
            },
            dataType:'json',
            success:function(data){
                if(data.success == true)
                {
                    model.parent().parent('.push_main').remove();
                    $('.push_mask').show();
                    $('.push_div').show();
                }else{
                    alert(data.msg);
                }

            }
        })
    })
    $('.push_p2').click(function () {
    	$('.push_mask').hide();
        $('.push_div').hide();
    })
</script>
</html>
